import { Controller, Get, Post, Body, Patch, Param, Delete, Query, UseInterceptors } from "@nestjs/common";
import { ConfigService } from "./config.service";
import { ApiBearerAuth, ApiOperation, ApiTags } from "@nestjs/swagger";
import { NotToken } from "@/decorators/not-token.decorator";

@Controller("system/config")
@ApiTags("系统设置")
@ApiBearerAuth()
export class ConfigController {
    constructor(private readonly configService: ConfigService) {
    }
    
    @Post()
    create(@Body() createLogDto) {
        return this.configService.create(createLogDto);
    }
    
    @Get()
    findAll(@Query() dto) {
        return this.configService.findAll(dto);
    }
    
    // @Get("findOneByAppType")
    // @ApiOperation({ summary: "更具appType获取系统配置" })
    // @AllowAnon()
    // findOneByAppType(@Query() dto) {
    //     return this.sysConfigService.findOneByAppType(dto);
    // }
    
    @Get(":id")
    findOne(@Param("id") id: string) {
        return this.configService.findOne(+id);
    }
    
    @Patch(":id")
    update(@Param("id") id: string, @Body() updateLogDto) {
        return this.configService.update(+id, updateLogDto);
    }
    
    @Delete("removeByIds")
    removeByIds(@Body() dto) {
        return this.configService.removeByIds(dto);
    }
    
    @Delete(":id")
    remove(@Param("id") id: string) {
        return this.configService.remove(+id);
    }
}
